test_case = int(input())
for i in range(test_case):
arr_size = int(input())
arr = list(map(int,input().split()))
n = len(arr)
boolean = False
for i in range(n):
if arr[i] % arr[0] == 0:
boolean = True
else:
boolean = False
break
if boolean == True:
print("YES")
else:
print("NO")
#include <bits/stdc++.h>
using namespace std;
// #define f(a,n) for(int i=a;i<n;i++)
int main()
{
int t,n;
cin>>t;
while(t--){
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
int count=0;
for(int i=1;i<n;i++){
if(arr[i]%arr[0]==0)
count++;
}
if(count==n-1)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return 0;
}
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |